﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="productcategories.aspx.cs"
    Inherits="website_admin_insurance_productcategories" %>

<%@ Register Src="~/admin/_root/_controls/ctlNavBar.ascx" TagName="ctlNavBar" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script src="../_common/scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript" src="../_common/scripts/util.js"></script>
    
    <link href="../../_common/styles/form_2_0.css" rel="stylesheet" type="text/css" />
    <link href="../_common/styles/frame_global.css" rel="stylesheet" type="text/css" />
    <link href="../../_common/flexigrid/flexigrid_blue.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript">   
        $(document).ready(setup);
        function setup()
        {
            LoadingTreeData(); 
        }
        function LoadingTreeData() {
            $.ajax({
                async: true,
                type: "POST",
                url: "productcategories.aspx",
                data: { otype: "loadingtreedata", typecode: getUrlParam("typecode") },
                beforeSend: function() {
                    $("#tbTreeArea tbody").html(""); 
                    $("#tbTreeArea tbody").html("<tr class=\"trTreeAreaItems\" id=\"tr_-1\" style=\"border-bottom: 0px;\"><td colspan=\"3\" class=\"body\" style=\"border-left: 0px;border-bottom: 0px;height: 100px;\">" + $("#divTreeLoading").html() + "</td></tr>"); 
                },
                success: function(data, textStatus) {
                    $("#tbTreeArea tbody").html("");  
                    if(Trim(data) != "")
                    { 
                        $("#tbTreeArea tbody").html(data); 
                    }
                    else
                    {
                        $("#tbTreeArea tbody").html("<tr class=\"trTreeAreaItems\" id=\"tr_-1\"><td colspan=\"3\" class=\"body\" style=\"height: 100px;\">Null.</td></tr>"); 
                    }
                }
            });
        } 
        function TreeNoteShow(_obj) {
            if (_obj.vtype == "minus") {
                $("#tr_" + _obj.categoryid).css("display", "none");
                _obj.vtype = "plus";
                _obj.src = "../_imgs/admin/plus.gif";
            }
            else {
                $("#tr_" + _obj.categoryid).css("display", "");
                _obj.vtype = "minus";
                _obj.src = "../_imgs/admin/minus.gif";
            }
        }
        function TreeNoteExtendAll() {
            $("img[oname='imgTreeNoteIco']").each(function() {
                 jQuery(this).trigger("click"); 
            }); 
        } 
        function Delete(_objectId) { 
            if (confirm("Are you sure you want to delete this item?"))
            {
               $.ajax({
                    async: false,
                    type: "POST",
                    url: "productcategories.aspx",
                    data: {
                        otype: "delete",
                        objectId: _objectId
                    },
                    success: function(data, textStatus) { 
                        if (data == "succeeded") {
                            alert("删除成功!");
                            LoadingTreeData();
                        }
                        else {
                            alert(data);
                        }
                    }
                });
            }
        } 
        function OpenDia(otype, objectid) { 
            switch (otype) {
                case "modify":
                    openStdWin(prependOrgName("/website_admin/insurance/productcategoryeditor.aspx?otype=modify&productid=" + objectid + "&typecode=" + getUrlParam("typecode")), buildWinName(), 720, 525); 
                    break;
                case "add":
                    openStdWin(prependOrgName("/website_admin/insurance/productcategoryeditor.aspx?otype=add&typecode=" + getUrlParam("typecode")), buildWinName(), 720, 525);  
                    break;
                case "addchildnode":
                    openStdWin(prependOrgName("/website_admin/insurance/productcategoryeditor.aspx?otype=add&parentid=" + objectid + "&typecode=" + getUrlParam("typecode")), buildWinName(), 720, 525);  
                    break;
            }
        } 
    </script>

</head>
<body scrool="no" style="margin: 0px; padding: 0px;">
    <form id="aspnetForm" runat="server">
        <div id="divTreeLoading" style="display: none;">
            <table style="background-color: #eeeeee; table-layout: fixed; width: 100%; height: 100%;"
                cellpadding="0" cellspacing="0">
                <tr>
                    <td style="text-align: center; border: 0px; vertical-align: middle;">
                        <div style="width: 200px; margin-left: 245px;">
                            <img border="0" src="../_imgs/admin/progress.gif" />
                            <span style="line-height: 42px;">Loading ... </span>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="divAreas">
            <div class="boxTopBar_1">
                <div class="navBar">
                    <uc1:ctlNavBar ID="CtlNavBar1" runat="server" />
                </div>
            </div>
            <table cellpadding="0" cellspacing="0" class="stdTable">
                <tbody>
                    <tr style="height: 100%;">
                        <td valign="top" style="padding: 5px 5px 0px;">
                            <div class="flexigrid">
                                <div class="tDiv">
                                    <div class="tDiv2">
                                        <div class="fbutton">
                                            <div>
                                                <span class="add" onclick="OpenDia('add', null);">添加目录</span></div>
                                        </div>
                                    </div>
                                    <div style="clear: both">
                                    </div>
                                </div>
                                <div class="bDiv_Box" style="text-align: center;"> 
                                    <table cellpadding="0" cellspacing="0" style="border: 0px; width: 863px; margin: auto auto;">
                                        <colgroup>
                                            <col style="width: 80px" />
                                            <col />
                                        </colgroup>
                                        <tbody>
                                            <tr style="height: 25px;">
                                                <td colspan="2" valign="top" style="padding-left: 0px;">
                                                    <a onclick="LoadingTreeData();" id="RefreshItems" href="#" style="display: none;"></a>
                                                    <table class="tbTreeArea" cellpadding="0" cellspacing="0" align="center" style="width: 863px;
                                                        border-left: 0px;">
                                                        <colgroup>
                                                            <col />
                                                            <col style="width: 120px;" />
                                                            <col style="width: 220px;" />
                                                            <col style="width: 19px;" />
                                                        </colgroup>
                                                        <tbody>
                                                            <tr class="trTreeAreaHeader">
                                                                <td style="vertical-align: middle;">
                                                                    名称
                                                                </td>
                                                                <td style="vertical-align: middle;">
                                                                    类型
                                                                </td>
                                                                <td colspan="2" style="vertical-align: middle;">
                                                                    操作
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr style="height: 100%; padding-bottom: 10px; vertical-align: top; padding-top: 0px;">
                                                <td colspan="2" style="padding-right: 0px;">
                                                    <div style="overflow-y: scroll; overflow-x: hidden; height: 320px; border: 1px #CCCCCC solid; border-right: 0px #CCCCCC solid; 
                                                        margin-left: auto; margin-right: auto; padding: 0px 0px 0px 0px; border-bottom: 1px #CCCCCC solid; vertical-align: top; background: #eeeeee;">
                                                        <table id="tbTreeArea" class="tbTreeArea" cellpadding="0" cellspacing="0" align="center" style="margin: 0px 0px 0px 0px; 
                                                            border-right: 0px #CCCCCC solid; border-bottom: 0px #CCCCCC solid; border-left: 0px #CCCCCC solid; border-top: 0px #CCCCCC solid; width: 842px; height: 100%;
                                                            background: #eeeeee;">
                                                            <colgroup>
                                                                <col />
                                                                <col style="width: 120px;" />
                                                                <col style="width: 220px;" />
                                                            </colgroup>
                                                            <tbody>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="vGrip">
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </form>
</body>
</html>
